package archer.framework.web.sms;

import archer.framework.utils.ValidateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 短信发送服务
 *
 * @author christ
 * @date 2015/11/2
 */
@Component
public class SMSSenderService {

    @Autowired(required = false)
    protected SMSSender smsSender;

    private final static Logger logger = LoggerFactory.getLogger(SMSSenderService.class);

    /**
     * 发送
     *
     * @param mobile
     * @param content
     * @throws SMSException
     */
    public void send(String mobile, String content) throws SMSException {
        if (ValidateUtils.isNotEmpty(smsSender)) {
            smsSender.send(mobile, content);
            return;
        }
        logger.warn(">>>>>>>>>>>>>>>>>>>>>>>>> no SMSSender impl...");

    }
}
